<template>
  <div class="approvals-container">
    <div class="app-container">
      <h2>
        审批
        <UploadExcel :on-success="handleSuccess" :before-upload="beforeUpload" />
      </h2>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Approvals',
  methods: {
    beforeUpload(file) {
      const isLt1M = file.size / 1024 / 1024 < 1
      if (isLt1M) {
        return true
      }
      this.$message({
        message: '请不要上传超过1M的文件',
        type: 'warning'
      })
      return false
    },
    handleSuccess({ results, header }) {
      // results 对应的是excel中的数据 header对应的是excel中的表头
      console.log(results, header)
      this.tableData = results
      this.tableHeader = header
    }
  }
}
</script>

<style>

</style>
